import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";

var _class, _temp;

import React from "react";
import { BlockContainer } from "./index.style";
import SectionTitle from "../_components/SectionTitle";
import ConfigItem from "../_components/ConfigItem";
import withFormOperate from "../_components/withFormOperate";
import { getMemoizedAssets } from "./util";

var SelectConfig = withFormOperate(_class = (_temp = /*#__PURE__*/function (_React$Component) {
  _inherits(SelectConfig, _React$Component);

  function SelectConfig() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, SelectConfig);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SelectConfig)).call.apply(_getPrototypeOf2, [this].concat(args)));
    _this.getRadio = getMemoizedAssets(_this.props.styleCounts.radio, "radio/radio");
    _this.getRadioButton = getMemoizedAssets(_this.props.styleCounts.radio, "radio/radiobutton");
    _this.getCheckbox = getMemoizedAssets(_this.props.styleCounts.checkbox, "checkbox/checkbox");
    _this.getCheckboxBtn = getMemoizedAssets(_this.props.styleCounts.checkboxBtn, "checkbox/checkbox-btn");
    return _this;
  }

  _createClass(SelectConfig, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          value = _this$props.value,
          handleChange = _this$props.handleChange,
          schema = _this$props.schema;
      return React.createElement(BlockContainer, {
        id: "select-box-config"
      }, React.createElement(SectionTitle, {
        title: "\u9009\u62E9\u5668",
        titleTail: "SelectBox"
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: "Radio",
        items: this.getRadio(schema),
        defaultSelected: value.radio,
        onChange: handleChange("radio")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: "RadioButton",
        items: this.getRadioButton(schema),
        defaultSelected: value.radioButton,
        onChange: handleChange("radioButton")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: "Checkbox",
        items: this.getCheckbox(schema),
        defaultSelected: value.checkbox,
        onChange: handleChange("checkbox")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: "Checkbox-button",
        items: this.getCheckboxBtn(schema),
        defaultSelected: value.checkboxBtn,
        onChange: handleChange("checkboxBtn")
      }));
    }
  }]);

  return SelectConfig;
}(React.Component), _temp)) || _class;

export { SelectConfig as default };